package main

import (
	"flag"
	"log"
	"os"
	"path/filepath"
	"tmp/proc"
)

func main() {
	var port int
	var dir string

	currDir, err := filepath.Abs(filepath.Dir(os.Args[0]))
	if err != nil {
		log.Fatal(err)
	}
	www := filepath.Join(currDir, "www")

	flag.IntVar(&port, "p", 10087, "http api port")
	flag.StringVar(&dir, "d", www, "web files dir")
	flag.Parse()

	log.SetFlags(log.Lshortfile | log.LstdFlags)

	go proc.Watch()
	proc.ApiServ(port, dir)
}
